package exam.service.impl;

import exam.dao.BookDao;
import exam.dao.UserDao;
import exam.service.UserService;

public class UserServiceImpl implements UserService {
    private UserDao userDao;
    private BookDao bookDao;
    private int num;
    private String version;

    public UserServiceImpl() {
    }

    public UserServiceImpl(UserDao userDao, int num, String version) {
        this.userDao = userDao;
        this.num = num;
        this.version = version;
    }

    public UserServiceImpl(UserDao userDao,BookDao bookDao) {
        this.userDao = userDao;
        this.bookDao= bookDao;
    }



    public void setBookDao(BookDao bookDao) {
        this.bookDao = bookDao;
    }

    public void setVersion(String version) {
        this.version = version;
    }

    public void setNum(int num) {
        this.num = num;
    }

    //1.对需要进行诸如的变量添加set方法
    public void setUserDao(UserDao userDao) {
        this.userDao = userDao;
    }

    @Override
    public void save() {
//        System.out.println("user service running...");

        System.out.println("user service running..." + num + " " + version);
        userDao.save();
        bookDao.save();
    }

}
